package com.neuedu.his.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.neuedu.his.mapper.RegisterMapper;
import com.neuedu.his.po.Register;
import com.neuedu.his.service.RegisterService;
import org.springframework.stereotype.Service;

@Service
public class RegisterServiceImpl extends ServiceImpl<RegisterMapper, Register>
        implements RegisterService {

    @Override
    public Integer getMaxId() {
        // 使用MyBatis Plus的LambdaQueryWrapper构建查询
        Register lastRegister = this.lambdaQuery()
                .orderByDesc(Register::getId)
                .last("LIMIT 1")
                .one();

        return lastRegister != null ? lastRegister.getId() : 0;
    }
}